﻿package view.component
{
    import com.greensock.*;
    import com.sh.game.consts.*;
    import com.sh.game.global.*;
    import com.sh.game.util.*;
    import flash.geom.*;
    import morn.core.components.*;
    import morn.core.handlers.*;

    public class ListFly extends Object
    {

        public function ListFly()
        {
            return;
        }// end function

        public static function go(param1:List, param2:Handler = null) : void
        {
            var _loc_5:int = 0;
            var _loc_6:Array = null;
            var _loc_7:Component = null;
            var _loc_8:Object = null;
            var _loc_9:String = null;
            var _loc_10:Image = null;
            var _loc_11:Image = null;
            var _loc_12:Point = null;
            var _loc_3:* = UIGlobel.pointsDic["bag"];
            var _loc_4:* = new TimelineLite();
            _loc_5 = 0;
            _loc_6 = [];
            for each (_loc_7 in param1.cells)
            {
                
                _loc_8 = param1.array[_loc_5];
                if (_loc_8 == null)
                {
                    continue;
                }
                _loc_9 = UIGlobel.getItemd(1) + _loc_8.icon + Config.IconExtension;
                _loc_9 = Config.getUrl(_loc_9, ResourceType.NORMAL);
                _loc_10 = new Image(_loc_9);
                _loc_11 = _loc_7.getChildByName("icon") as Image;
                _loc_12 = _loc_11.localToGlobal(new Point(0, 0));
                _loc_10.x = _loc_12.x;
                _loc_10.y = _loc_12.y;
                _loc_10.width = _loc_11.width;
                _loc_10.height = _loc_11.height;
                GlobalLayer.instance.root.stage.addChild(_loc_10);
                _loc_6.push(_loc_10);
                _loc_5++;
                if ((_loc_5 + 1) == param1.array.length)
                {
                    _loc_4.append(new TweenLite(_loc_10, 3, {x:_loc_3.x, y:_loc_3.y, onComplete:moveAllComplete, onCompleteParams:[_loc_6, _loc_4, param2]}), -2.8);
                    continue;
                }
                _loc_4.append(new TweenLite(_loc_10, 3, {x:_loc_3.x, y:_loc_3.y}), -2.8);
            }
            return;
        }// end function

        public static function moveAllComplete(param1:Array, param2:TimelineLite, param3:Handler) : void
        {
            var _loc_4:Image = null;
            for each (_loc_4 in param1)
            {
                
                GlobalLayer.instance.root.stage.removeChild(_loc_4);
                _loc_4 = null;
            }
            param1 = null;
            param2.kill();
            param2 = null;
            if (param3 != null)
            {
                param3.execute();
                param3.dispose();
                param3 = null;
            }
            return;
        }// end function

    }
}
